# Online Booking Tool — 3-page split

Split from the original single-file mockup into three genuinely separate
pages, each talking to the mock ServiceTitan API independently over real
HTTP — no shared in-page state between them.

## What's in here

- **`landing.html`** — the customer-facing booking widget.
- **`dispatch.html`** — the ServiceTitan-style dispatch board. Polls the
  mock server every ~3.5s, so a booking made on `landing.html` shows up
  here live, in a separate tab, without a page refresh.
- **`traffic.html`** — a live view of real request/response JSON as it
  actually happens against the mock server (not a sample/illustration).
- **`st-live-adapter.js`** — shared by all three: the real ServiceTitan-shaped
  API client (`LiveDataAdapter`) plus small formatting/matching helpers.
  Deliberately not named `common.js` — that generic name gets silently
  dropped by ad-blocker filter lists (`net::ERR_BLOCKED_BY_CLIENT`) on a
  real public domain, which breaks every page since they all depend on
  `LiveDataAdapter`. Don't rename it back to something generic.
- **`servicetitan-mock/`** — the local Node/Express mock API server.

## Running it

```bash
# Terminal 1 — the mock ServiceTitan API
cd servicetitan-mock
npm install
node server.js          # http://localhost:4010

# Terminal 2 — serves the three HTML pages
npx serve                # or: python3 -m http.server 8080
```

Then open `landing.html`, `dispatch.html`, and `traffic.html` in separate
tabs from whatever URL the second command prints. Book something on
`landing.html` and watch it appear on `dispatch.html` (within a few
seconds) and in `traffic.html` (as it happens).

## What changed from the single-file version

- **No more "time travel."** The old testing controls (+1 Day, Reset to
  real now) are gone — everything uses real current time. The mock server
  seeds a handful of jobs dated to whatever day it actually starts on, so
  the dispatch board isn't empty on first load.
- **No more cross-tab sync via BroadcastChannel.** It's unnecessary now —
  both pages independently read from the same real server, so there's
  nothing to manually keep in sync.
- **The old "API Request Preview" panel is gone**, replaced by
  `traffic.html` showing genuinely real traffic instead of illustrative
  samples.

## Before connecting to a real ServiceTitan tenant

Same caveats as before — see `ACTIVE_ADAPTER`'s config in `st-live-adapter.js`
(shared by all three pages now, so there's only one place to change it):
swap `apiBase`/`authUrl` for ServiceTitan's real domains, put real
credentials behind a backend proxy (not in browser-side JS), and
double-check the arrival-windows time format assumption against a real
tenant response.
